home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / os2 / xfeel11b.zip / XFEEL2.C < prev    next >
Text File  |  1993-02-16  |  4KB  |  115 lines

  1. /*-------------------------------------------------------------------------*/
  2. /*                                                                         */
  3. /*   XFEEL2.C   : Compile this Module to XFEEL.DLL and place it in the     */
  4. /*                LIBPATH.                                                 */
  5. /*                                                                         */
  6. /*   Version    : V1.1b                                                    */
  7. /*                                                                         */
  8. /*   Date       : 31.07.92                                                 */
  9. /*                                                                         */
  10. /*   Copyright  : Markus Hof & Roman Fischer                               */
  11. /*                    EMAIL : mhof@iiic.ethy.ch                              */
  12. /*                            rofische@iiic.ethz.ch                           */
  13. /*                                                                         */
  14. /*    History:
  15.     
  16.     28.10.92    MH    Removed Shared Segment
  17.     5.1.93        MH    DONTCHANGEZORDER
  18.     11.2.93        MH    Bugfix for lost characters
  19. */
  20. /*-------------------------------------------------------------------------*/
  21. #define INCL_DOSPROCESS
  22. #define INCL_WININPUT
  23. #define INCL_WINWINDOWMGR
  24. #define INCL_WINFRAMEMGR
  25. #define INCL_DOSMEMMGR
  26.  
  27. #include <os2pm.h>
  28. #include <stdio.h>
  29.  
  30.  
  31. #define DONTCHANGEZORDER
  32.  
  33.  
  34. HWND lastone = NULL;
  35. HWND lastowner = NULL;
  36.  
  37.  
  38. BOOL PASCAL XFUNC (HAB hab, PQMSG qmsg, USHORT msgf)
  39.     {
  40.     HWND        active;
  41.     HWND        w, wo;
  42.     HWND        parent, desktop;
  43.     char        classname[31];
  44.     HWND        title;
  45.  
  46.  
  47.     /*-------------------------------------------------------------*/
  48.     /* Only care for WM_MOUSEMOVE messages                         */
  49.  
  50.     if (qmsg->msg != WM_MOUSEMOVE)
  51.         return (FALSE);
  52.         
  53.     /*-------------------------------------------------------------*/
  54.     /* If mouse captured do nothing                                */
  55.     
  56.     if (WinQueryCapture (HWND_DESKTOP, FALSE))
  57.         return (FALSE);
  58.  
  59.  
  60.     /*-------------------------------------------------------------*/
  61.     /* Get active window. Break if active window is a frame window */
  62.     /* with the title 'Window List'. This means, that the tasklist */
  63.     /* is active => xfeel not active.                              */
  64.     
  65.     active    =    WinQueryActiveWindow (HWND_DESKTOP, FALSE);
  66.     WinQueryClassName (active, 30, (PCH)classname);
  67.     if (classname[1]=='1')
  68.         {
  69.         WinQueryWindowText (active, 30, (PCH)classname);
  70.         if (!strcmp (classname, "Window List"))
  71.             return (FALSE);
  72.         }
  73.  
  74.     /*-------------------------------------------------------------*/
  75.     /* Get info about new window.                                   */
  76.  
  77.     desktop    =    WinQueryDesktopWindow (hab, NULL);
  78.     wo = w    =    qmsg->hwnd;
  79.     parent    =    WinQueryWindow (w, QW_PARENT, FALSE);
  80.     while (parent != desktop)
  81.         {
  82.         wo = w;
  83.         w = parent;
  84.         parent = WinQueryWindow (w, QW_PARENT, FALSE);
  85.         }
  86.  
  87.     /*-------------------------------------------------------------*/
  88.     /* If new window is a menu break                               */
  89.  
  90.     WinQueryClassName (wo, 30, (PCH)classname);
  91.     if (!strcmp (classname, "#4"))
  92.         return (FALSE);
  93.  
  94.     /*-------------------------------------------------------------*/
  95.     /* Make new active if not active                               */
  96.  
  97.     if (w!=lastone)
  98.         {
  99.         lastone = w;
  100.         
  101. #ifndef DONTCHANGEZORDER
  102.         WinSetFocus (HWND_DESKTOP, WinWindowFromID (w, FID_CLIENT));
  103. #else
  104.         WinFocusChange (HWND_DESKTOP, WinWindowFromID (w, FID_CLIENT),
  105.                         FC_NOSETACTIVE);
  106.                         
  107.         title = WinWindowFromID (w, FID_TITLEBAR);
  108.         if (title)
  109.             WinPostMsg (w, WM_ACTIVATE, -1L, title);
  110. #endif
  111.         }
  112.  
  113.     return (FALSE);
  114.     }
  115.